ENT.Type 			= "anim"
ENT.Base 			= "base_anim"
ENT.PrintName		= "Metastrike Ammo Drop"

if CLIENT then

/*---------------------------------------------------------
   Name: Initialize
---------------------------------------------------------*/
function ENT:Initialize()
end

/*---------------------------------------------------------
   Name: DrawPre
---------------------------------------------------------*/
function ENT:Draw()
	
	self.Entity:DrawModel()
end

end

if SERVER then
AddCSLuaFile()

/*---------------------------------------------------------
   Name: Initialize
---------------------------------------------------------*/
function ENT:Initialize()

	self.Entity:SetModel("models/Items/boxmrounds.mdl")
	self.Entity:PhysicsInit(SOLID_VPHYSICS)
	self.Entity:SetMoveType(MOVETYPE_VPHYSICS)
	self.Entity:SetSolid(SOLID_VPHYSICS)
	self.Entity:DrawShadow(false)
	
	self.Entity:SetCollisionGroup(0)
	
	local phys = self.Entity:GetPhysicsObject()
	
	if (phys:IsValid()) then
		phys:Wake()
	end

	self.Entity:SetUseType(SIMPLE_USE)
end


/*---------------------------------------------------------
   Name: PhysicsCollide
---------------------------------------------------------*/
function ENT:PhysicsCollide(data, physobj)
	
	// Play sound on bounce
	if (data.Speed > 80 and data.DeltaTime > 0.2) then
		self.Entity:EmitSound("Default.ImpactSoft")
	end
	
	if data.HitEntity:IsPlayer() and data.HitEntity:Alive() then
		self.Entity:Remove()

	//	self.Entity:EmitSound("BaseCombatCharacter.AmmoPickup")
		
		// Give the collecting player some free health
		data.HitEntity:GiveAmmo(self.PAmmo, "pistol")
		data.HitEntity:GiveAmmo(self.SAmmo, "ar2")
	end
end

/*---------------------------------------------------------
   Name: OnTakeDamage
---------------------------------------------------------*/
function ENT:OnTakeDamage(dmginfo)

	// React physically when shot/getting blown
	self.Entity:TakePhysicsDamage(dmginfo)
end


/*---------------------------------------------------------
   Name: Use
---------------------------------------------------------*/
function ENT:Use(activator, caller)

	self.Entity:Remove()

//	self.Entity:EmitSound("BaseCombatCharacter.AmmoPickup")
	
	if (activator:IsPlayer()) then
		// Give the collecting player some free health
		activator:GiveAmmo(self.PAmmo, "pistol")
		activator:GiveAmmo(self.SAmmo, "ar2")
	end
end

end